package com.bawei.wyg.mycommerce.thread;

import android.os.Handler;
import android.os.Message;

import androidx.annotation.NonNull;

import java.lang.ref.WeakReference;

public class TimerHandler extends Handler {
    private WeakReference<TimerCallBack> weakReference;

    public  TimerHandler(TimerCallBack callBack){
        weakReference=new WeakReference<>(callBack);
    }

    @Override
    public void handleMessage(@NonNull Message msg) {
        super.handleMessage(msg);
        weakReference.get().callBack();;
    }

    public interface TimerCallBack{
        void callBack();
    }
}
